package com.example.questionnaire.mbg.service.impl;

import com.example.questionnaire.mbg.entity.Option;
import com.example.questionnaire.mbg.mapper.OptionMapper;
import com.example.questionnaire.mbg.service.IOptionService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Primary
@Service
public class OptionServiceImpl implements IOptionService {

    @Resource
    private OptionMapper optionMapper;

    @Override
    public void create(Option option) {
        optionMapper.create(option);
    }

    @Override
    public Option getByOptionNumber(int questionId, int optionNumber) {
        return optionMapper.getByOptionNumber(questionId, optionNumber);
    }

    @Override
    public void delete(int id) {
        optionMapper.delete(id);
    }

    @Override
    public Option get(int oid) {
        return optionMapper.get(oid);
    }

    @Override
    public List<Option> listAll(int qid) {
        return optionMapper.listAll(qid);
    }

    @Override
    public int getSumByQid(int qid) {
        return optionMapper.getSumByQid(qid);
    }

    @Override
    public void update(Option option) {
        optionMapper.update(option);
    }

    @Override
    public void deleteBYQid(int qid) {
        optionMapper.deleteBYQid(qid);
    }

    @Override
    public Option getByQidAndOnum(int qid, int onum) { return optionMapper.getByQidAndOnum(qid, onum); }

    @Override
    public List<Option> getAnswer(int qid) { return optionMapper.getAnswer(qid); }
}